package com.study.happystudy.service.impl;

import com.study.happystudy.mapper.PointTransactionMapper;
import com.study.happystudy.po.PointTransaction;
import com.study.happystudy.service.PointTransactionService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PointTransactionServiceImpl implements PointTransactionService {
    @Resource
    PointTransactionMapper pointTransactionMapper;
    @Override
    public void insertPointTransaction(int userId, int points, String reason) {
        pointTransactionMapper.insertPointTransaction(userId,points,reason);
    }

    @Override
    public List<PointTransaction> getPointTransactionByUserId(int userId) {
        return pointTransactionMapper.getPointTransactionByUserId(userId);
    }

    @Override
    public void updatePointTransaction(int userId, int points, String reason, String time) {
        pointTransactionMapper.updatePointTransaction(userId,points,reason,time);
    }

    public PointTransaction getPointTransactionById(int transactionId) {
        return pointTransactionMapper.getPointTransactionById(transactionId);
    }
}
